<script>
    import base from "@/config/baseUrl";
    import store from "@/store";
	import socket from '@/plugins/socket';
    // #ifdef APP-PLUS
    import APPUpdate from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
    // #endif
    import { mpUpData,scene } from '@/config/common';
	export default {
		onLaunch(e) {
		/*
		let getBid = this.$tools.getExtStoreId('bid');
		if (getBid>0&&uni.getExtConfigSync&&getBid!=undefined){
			let busdata = {
				bid:getBid
			};
			try{
				const extConfig = uni.getExtConfigSync()
				this.$store.commit("set_extConfig",extConfig);
			}catch(err){}
		}
		*/
		this.$store.dispatch("getsiteInfo",{bid:this.$store.state.extConfig.bid}).then(rs=>{
			console.log('getsiteInfo',rs)
		});

			//取出缓存数据
			store.commit('setCacheData');
			
			if (store.state.userInfo.token==true) {
				socket.init();
			}
			
			
            // #ifdef APP-PLUS
            APPUpdate() //检测app更新
            // #endif
			
		},
		onShow(e) {
			console.log('App show')
			//async await this.$store.dispatch("getsiteInfo",{bid:this.$store.state.extConfig.bid}).then(rs=>{});
			
			// #ifdef MP
			
		let query=e.query;
		
		if (query == null || query=="" || query==undefined){
			 
		}else{
			//if(query.q!=''){
					//let q = decodeURIComponent(e.query.q);
					//let zid = this.$tools.getQueryString(q, 's');
					//let gid = this.$tools.getQueryString(q, 'g');
					// if (zid>0){
					// 	// e.query = {
					// 	// 	content_id:zid
					// 	// }
					// 	// console.log('e.query',e.query)
					// 	//tools.routerTo('/pages/componentsC/zhuan/publish_sell_view', {content_id:zid}, true);
					// 	let data = {content_id:zid}
					// 	let path='/pages/componentsC/zhuan/publish_sell_view?query='+encodeURIComponent(JSON.stringify(data))
					// 	uni.reLaunch({
					// 		url: path
					// 	})
					// }
					// if (gid>0){
					// 	let shopid = this.$tools.getQueryString(q, 'shop_id');
					// 	//tools.routerTo('/pages/componentsC/shop/index', {shop_id:shopid,goods_id:gid}, true);
					// 	let data = {shop_id:shopid,goods_id:gid}
					// 	let path='/pages/componentsC/shop/index?query='+encodeURIComponent(JSON.stringify(data))
					// 	uni.reLaunch({
					// 		url: path
					// 	})
					// }
			//}
		}

			mpUpData() //检测小程序更新
			// #endif
			
			scene(e) //获取二维码信息
			
		},
		onHide() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
/* #ifndef APP-NVUE */
@import './style/iconfont/iconfont.css';
@import "@/uni_modules/uview-ui/index.scss";
@import "./style/common.scss";
@import "@/uni_modules/uview-ui/libs/css/flex.scss";
page {
    background-color: #ffffff;
}
	uni-page-body,body,page{
		min-height:calc(100vh - var(--status-bar-height));
		//display: flex;
		//flex-direction: column;
		//box-sizing: border-box;
		font-size: 28rpx;
		//flex-direction: row;
		//flex-wrap: wrap;
		//align-items: center;
		font-family: 'DINAlternate'; font-style: normal;
	}
// 隐藏滚动条
::-webkit-scrollbar {
    width: 0;
    height: 0;
    color: transparent;
}
/* #endif */
</style>
